package com.originskyseed.platform.task.mapper;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Param;

import com.originskyseed.platform.task.model.TaskRelateAssignPerson;

/**
 * 任务关联指派人表Mapper类（OSI_TASK_RELATE_ASSIGN_PERSON）
 *
 * @author wlj
 */
public interface TaskRelateAssignPersonMapper {

	/**
	 * 删除记录
	 *
	 * @param id
	 * @return
	 * @throws Exception
	 */
	public int deleteByPrimaryKey(String id) throws Exception;

	/**
	 * 批量删除记录
	 *
	 * @param ids
	 * @return
	 * @throws Exception
	 */
	public int deleteByPrimaryKeys(List<String> ids) throws Exception;

	/**
	 * 插入记录
	 *
	 * @param record
	 * @return
	 * @throws Exception
	 */
	public int insert(TaskRelateAssignPerson record) throws Exception;

	/**
	 * 插入记录（仅非空值字段）
	 *
	 * @param record
	 * @return
	 * @throws Exception
	 */
	public int insertSelective(TaskRelateAssignPerson record) throws Exception;

	/**
	 * 批量插入
	 *
	 * @param list
	 * @return
	 * @throws Exception
	 */
	public int insertBatch(List<TaskRelateAssignPerson> list) throws Exception;

	/**
	 * 更新记录
	 *
	 * @param record
	 * @return
	 * @throws Exception
	 */
	public int updateByPrimaryKey(TaskRelateAssignPerson record) throws Exception;

	/**
	 * 更新记录（仅非空值字段）
	 *
	 * @param record
	 * @return
	 * @throws Exception
	 */
	public int updateByPrimaryKeySelective(TaskRelateAssignPerson record) throws Exception;

	/**
	 * 通过任务ID更新任务状态逾期
	 *
	 * @param taskId
	 * @return
	 * @throws Exception
	 */
	public int updateStateByTaskId(@Param("taskId") String taskId, @Param("state") int state, @Param("userId") String userId) throws Exception;

	/**
	 * 推广任务完成
	 *
	 * @param taskId
	 * @return
	 * @throws Exception
	 */
	public int updateFinishTaskByTaskId(@Param("taskId") String taskId) throws Exception;

	/**
	 * 通过任务id删除任务
	 *
	 * @param taskId
	 * @return
	 * @throws Exception
	 */
	public int deleteByTaskId(@Param("taskId") String taskId) throws Exception;

	/**
	 * 任务已读
	 *
	 * @param taskId
	 * @return
	 * @throws Exception
	 */
	public int taskIsRead(@Param("taskId") String taskId, @Param("userId") String userId) throws Exception;

	/**
	 * 查询记录
	 *
	 * @param id
	 * @return
	 * @throws Exception
	 */
	public TaskRelateAssignPerson selectByPrimaryKey(String id) throws Exception;

	/**
	 * 查询列表
	 *
	 * @param record
	 * @return
	 * @throws Exception
	 */
	public List<TaskRelateAssignPerson> selectList(TaskRelateAssignPerson record) throws Exception;

	/**
	 * 分页查询列表
	 *
	 * @param params
	 * @return
	 * @throws Exception
	 */
	public List<TaskRelateAssignPerson> selectListByPage(Map<String, Object> params) throws Exception;

	/**
	 * 根据taskId更新记录
	 *
	 * @param record
	 * @return
	 * @throws Exception
	 */
	public int updateByTaskId(TaskRelateAssignPerson record) throws Exception;

	/**
	 * 根据任务ID查询记录
	 *
	 * @param id
	 * @return
	 * @throws Exception
	 */
	public TaskRelateAssignPerson selectByTaskId(String id) throws Exception;

	/**
	 * 根据任务ID查询记录
	 *
	 * @param id
	 * @return
	 * @throws Exception
	 */
	public List<TaskRelateAssignPerson> selectListByTaskId(String id) throws Exception;

	/**
	 * 根据对象查询
	 *
	 * @param record
	 * @return
	 * @throws Exception
	 */
	public TaskRelateAssignPerson selectByTaskTaskRelateAssignPerson(TaskRelateAssignPerson record) throws Exception;

	/**
	 * 查询是否有我的数据
	 *
	 * @param map
	 * @return
	 * @throws Exception
	 */
	public TaskRelateAssignPerson selectIsMyTask(Map<String, Object> map) throws Exception;

	/**
	 * 查询是否有我记录
	 *
	 * @param taskId
	 * @param userId
	 * @return
	 * @throws Exception
	 */
	public TaskRelateAssignPerson selectPaperIsMyTask(@Param("taskId") String taskId, @Param("userId") String userId) throws Exception;

	/**
	 * 统计未读任务
	 *
	 * @param userId
	 * @return
	 * @throws Exception
	 */
	public Integer countTaskIsRead(String userId) throws Exception;

}
